﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using FreeSwitch.EventSocket.Events;
using FreeSwitch.EventSocket.Events.Channel;
using Xunit;

namespace FreeSwitch.EventSocket.Tests
{
	public class EventDispatcherTest
	{
		EventDispatcher _dispatcher = new EventDispatcher();

		[Fact]
		private void Test()
		{
			ChannelApplication evt = null;
			var msg = MessageHelper.ParsedMessage("ChannelApplication");
			_dispatcher.EventReceived += (o, e) => { evt = (ChannelApplication)e.Evt; };
			//_dispatcher.ScanForEvents(typeof (EventDispatcher).Assembly);
			_dispatcher.Process(msg);
			Assert.Equal("sofia/internal/23702@domain23702.com", evt.Caller.ChannelInfo.ToString());
			Assert.Equal("internal", evt.Caller.ChannelInfo.ProfileName);
		}

	}
}
